<template>
  <el-dialog
    top="8vh"
    class="workflow"
    :visible.sync="isVisiable"
    v-if="isVisiable"
    width="90%"
    custom-class="workflow"
    :close-on-click-modal="false"
    append-to-body
  >
    <div
      ref="mydiv"
      :style="
        'margin-left:-10px;pointer-events: none; background-color:transparent;position:absolute;width:100%;height:' +
        (clientHeight - 180) +
        'px;'
      "
    ></div>
    <el-tabs
      type="card"
      v-model="activeName"
      class="tabBox"
      style="height: 70vh; margin-bottom: 10px"
    >
      <!--      <el-tab-pane label="业务信息" :style="'height:' + (clientHeight - 300) + 'px;'">-->
      <el-tab-pane label="业务信息">
        <el-container>
          <el-container>
            <!--            <el-main class="scorll-box"-->
            <!--                     :style="'height:' + (clientHeight*1 - (dqTask.attachFileConfig.length > 0 ? (100+(dqTask.attachmentHeight||70)) : 0) - 270) + 'px;'">-->
            <el-main class="scorll-box" style="height: 60vh">
              <div>
                <mainform
                  ref="mainform"
                  @returnFormData="returnFormData"
                  @changeFormData="changeFormData"
                  @refreshTableData="refreshTableData"
                  v-if="isVisiable"
                ></mainform>
              </div>
            </el-main>
          </el-container>

          <!--          <el-aside width="20%" style="margin-left: 20px;" class="avue-crud"-->
          <!--                    :style="'height:' + (clientHeight - 270) + 'px;'">-->
          <!-- <el-aside
            width="20%"
            style="margin-left: 20px; height: 60vh"
            class="avue-crud"
          >

          </el-aside> -->
        </el-container>
      </el-tab-pane>

      <!--      <el-tab-pane label="流程信息" :style="'height:' + (clientHeight - 300) + 'px;'" class="mb5">-->
      <el-tab-pane label="流程信息" class="mb5" v-if="showType">
        <el-container>
          <el-main class="yuanjiao boxsty">
            <el-form
              ref="forminfo"
              label-width="100px"
              v-if="wfYwMain.id != undefined"
              class="gongZuoLiu"
              style="height: 55vh; overflow-y: auto"
            >
              <div class="gzl">{{ wfYwMain.ywTitle }}</div>
              <!--              <el-form-item label="业务标题：">-->
              <!--                {{ wfYwMain.ywTitle }}-->
              <!--              </el-form-item>-->
              <el-form-item label="业务编号：">
                {{ wfYwMain.ywMainCode }}
              </el-form-item>
              <el-form-item label="业务类型：">
                {{ wfYwMain.flowName }}
              </el-form-item>
              <el-form-item label="业务版本：">
                {{ wfYwMain.flowEdition }}
              </el-form-item>
              <el-form-item label="业务状态：">
                {{ wfYwMain.ywState }}
              </el-form-item>
              <el-form-item label="审批状态：" v-show="wfYwMain.spState">
                {{ wfYwMain.spState }}
              </el-form-item>
              <el-form-item label="发起人：">
                {{ wfYwMain.fqRyName }}【{{ wfYwMain.fqDwName }}-{{
                  wfYwMain.fqBmName
                }}】
              </el-form-item>
              <el-form-item label="发起时间：">
                {{ $moment(wfYwMain.fqTime).format("YYYY-MM-DD HH:mm:ss") }}
              </el-form-item>
              <el-form-item
                label="办结人："
                v-show="wfYwMain.ywState == '已办结'"
              >
                {{ wfYwMain.bjRyName }}【{{ wfYwMain.bjDwName }}-{{
                  wfYwMain.bjBmName
                }}】
              </el-form-item>
              <el-form-item
                label="办结时间："
                v-show="wfYwMain.ywState == '已办结'"
              >
                {{ $moment(wfYwMain.bjTime).format("YYYY-MM-DD HH:mm:ss") }}
              </el-form-item>
              <el-form-item
                label="撤销人："
                v-show="wfYwMain.ywState == '已撤销'"
              >
                {{ wfYwMain.cxRyName }}【{{ wfYwMain.cxDwName }}-{{
                  wfYwMain.cxBmName
                }}】
              </el-form-item>
              <el-form-item
                label="撤销时间："
                v-show="wfYwMain.ywState == '已撤销'"
              >
                {{ $moment(wfYwMain.cxTime).format("YYYY-MM-DD HH:mm:ss") }}
              </el-form-item>
            </el-form>
            <!-- <div style="margin-top: 20px; height: 200px" v-show="wfFlowConfig.flowContent">
              <span v-html="toHtml(wfFlowConfig.flowContent)"></span>
            </div> -->
          </el-main>
          <el-aside width="70%" style="margin-left: 20px" class="boxsty">
            <el-container>
              <el-main>
                <el-table
                  :data="recordList"
                  style="width: 100%; height: 50vh; overflow-y: auto"
                  stripe
                >
                  <el-table-column prop="recordType" label="类型" width="80">
                  </el-table-column>
                  <el-table-column prop="czRyName" label="操作" width="180">
                  </el-table-column>
                  <el-table-column prop="recordInfo" label="记录">
                    <template slot-scope="scope">
                      {{ scope.row.recordInfo }}
                      <span
                        v-show="
                          [
                            '后续',
                            '启动',
                            '生成',
                            '删除',
                            '编辑',
                            '上传',
                            '盖章',
                          ].indexOf(scope.row.recordType) != -1
                        "
                      >
                        <el-button
                          v-show="scope.row.recordType == '上传'"
                          icon="el-icon-download"
                          @click="
                            downFile(
                              setJSON(scope.row.infoData).fileAdd,
                              setJSON(scope.row.infoData).fileName
                            )
                          "
                          type="primary"
                          size="mini"
                          >下载</el-button
                        >
                        <el-button
                          v-show="scope.row.recordType == '编辑'"
                          icon="el-icon-download"
                          @click="
                            downFile(
                              setJSON(scope.row.infoData).fileAdd,
                              setJSON(scope.row.infoData).fileName
                            )
                          "
                          type="primary"
                          size="mini"
                          >下载</el-button
                        >
                        <el-button
                          v-show="scope.row.recordType == '删除'"
                          icon="el-icon-download"
                          @click="
                            downFile(
                              setJSON(scope.row.infoData).fileAdd,
                              setJSON(scope.row.infoData).fileName
                            )
                          "
                          type="primary"
                          size="mini"
                          >下载</el-button
                        >
                        <el-button
                          v-show="scope.row.recordType == '生成'"
                          icon="el-icon-download"
                          @click="
                            downFile(
                              setJSON(scope.row.infoData).fileAdd,
                              setJSON(scope.row.infoData).fileName
                            )
                          "
                          type="primary"
                          size="mini"
                          >下载</el-button
                        >
                        <el-button
                          v-show="scope.row.recordType == '启动'"
                          icon="el-icon-view"
                          @click="open(setJSON(scope.row.infoData).id)"
                          type="primary"
                          size="mini"
                          >查看</el-button
                        >
                        <el-button
                          v-show="scope.row.recordType == '后续'"
                          icon="el-icon-view"
                          @click="open(setJSON(scope.row.infoData).id)"
                          type="primary"
                          size="mini"
                          >查看</el-button
                        >
                        <el-button
                          v-show="scope.row.recordType == '盖章'"
                          icon="el-icon-view"
                          @click="gaizhangUrl(scope.row.infoData)"
                          type="primary"
                          size="mini"
                          >查看</el-button
                        >
                      </span>
                    </template>
                  </el-table-column>
                  <el-table-column prop="recordTime" label="时间" width="140">
                    <template slot-scope="scope">
                      {{
                        $moment(scope.row.recordTime).format("YY-MM-DD HH:mm")
                      }}
                    </template>
                  </el-table-column>
                </el-table>
              </el-main>
            </el-container>
          </el-aside>
        </el-container>
      </el-tab-pane>
      <el-tab-pane label="审批流程" class="mb5">
        <el-image
              :src="actPicUrl"
              width="100%"
              title="点击此流程图可以放大显示图片..."
              style="cursor: pointer"
              v-if="actPicUrl != ''"
              :preview-src-list="[actPicUrl]"
            ></el-image>
        <!-- <div style="width: 96%; height: 95%" class="flowyuanjiao mt10">
          <div class="spTitle">审批流程</div>
          <div style="margin: 10px">
            <el-image
              :src="imgSvg"
              width="100%"
              title="点击此流程图可以放大显示图片..."
              style="cursor: pointer"
              v-if="imgSvg != ''"
              :preview-src-list="[imgSvg]"
            ></el-image>
          </div>
          <div
            style="margin: 10px"
            v-show="dqTask.taskExplain != '' && dqTask.taskExplain != undefined"
          >
            <span v-html="'办理提示：' + toHtml(dqTask.taskExplain)"></span>
          </div>
          <div class="spTip" v-show="retreatInfo.type != ''">
            <div class="spTip-title">{{ retreatInfo.type }}提示：</div>
            <div class="spTip-text" v-show="retreatInfo.type == '退回'">
              <div>
                〖{{ retreatInfo.userName }}〗于{{
                  $moment(retreatInfo.tgTime).format("YYYY-MM-DD HH:mm")
                }}时，在【{{
                  retreatInfo.thTaskName
                }}】环节将业务退回，退回原因如下：
              </div>
              <p>{{ retreatInfo.tgMessage }}</p>
            </div>
            <span v-show="retreatInfo.type == '转办'">
              <br />
              <span style="margin-left: 2em">
                〖{{ retreatInfo.userName }}〗于{{
                  $moment(retreatInfo.tgTime).format("YYYY-MM-DD HH:mm")
                }}时，将业务转办，转办原因如下：
              </span>
              <br />
              <span style="margin-left: 2em; font-weight: bold">
                {{ retreatInfo.tgMessage }}
              </span>
            </span>
          </div>
          <div style="margin: 10px">
            <el-timeline style="margin-top: 10px" v-if="false">
              <el-timeline-item
                :timestamp="' 【' + dqRyInfo.userName + '】' + dqTask.taskName"
                placement="top"
                v-if="mode == '建立' && dqRyInfo.userName != ''"
              >
                <el-card style="cursor: pointer">您正在办理..</el-card>
              </el-timeline-item>
              <el-timeline-item
                v-for="(t, index) in pzInfo"
                :key="index"
                :timestamp="' 【' + t.time + '】【' + t.ry + '】' + t.yd"
                placement="top"
              >
                <el-tooltip placement="left" effect="light">
                  <div slot="content">
                    开始时间：{{
                      t.info.ksTime
                        ? $moment(t.info.ksTime).format("YYYY-MM-DD HH:mm")
                        : "---"
                    }}<br />
                    查阅时间：{{
                      t.info.cyTime
                        ? $moment(t.info.cyTime).format("YYYY-MM-DD HH:mm")
                        : "---"
                    }}<br />
                    结束时间：{{
                      t.info.jsTime
                        ? $moment(t.info.jsTime).format("YYYY-MM-DD HH:mm")
                        : "---"
                    }}<br />
                    到期时间：{{
                      t.info.dqTime
                        ? $moment(t.info.dqTime).format("YYYY-MM-DD HH:mm")
                        : "---"
                    }}
                  </div>
                  <el-card style="cursor: pointer"
                    >{{ t.cz }}：{{ t.pz }}</el-card
                  >
                </el-tooltip>
              </el-timeline-item>
              <el-timeline-item
                v-for="(t, index) in wfYwStreamTemp"
                :key="index + 1000000"
                :timestamp="'' + t.userName + '' + t.taskName"
                placement="top"
              >
                <el-tooltip placement="left" effect="light">
                  <el-card style="cursor: pointer">等待办理..</el-card>
                </el-tooltip>
              </el-timeline-item>
            </el-timeline>
            <ul class="spFlow">
              <li v-if="mode == '建立' && dqRyInfo.userName != ''">
                <div
                  :class="
                    dqTask.taskName.length > 2 ? 'spFlow-img2' : 'spFlow-img'
                  "
                >
                  <div style="color: #00ff00">
                    {{ dqTask.taskName.substr(0, 2) }}
                    <span v-if="dqTask.taskName.length > 2"
                      ><br />{{ dqTask.taskName.substr(2) }}</span
                    >
                  </div>
                </div>
                <div class="spFlow-text">
                  <div>
                    <span>{{ dqRyInfo.userName }}</span>
                  </div>
                  <div>您正在办理..</div>
                </div>
              </li>
              <template v-if="wfYwMain.ywState != '已撤销'">
                <li v-for="(t, index) in pzInfo" :key="'j' + index">
                  <div :class="t.yd.length > 2 ? 'spFlow-img2' : 'spFlow-img'">
                    <div style="color: #00ff00">
                      {{ t.yd.substr(0, 2) }}
                      <span v-if="t.yd.length > 2"
                        ><br />{{ t.yd.substr(2) }}</span
                      >
                    </div>
                    <i
                      class="wait"
                      v-if="
                        t.pz === '正在审核中...' ||
                        t.pz === '正在查看中...' ||
                        t.pz === '正在审批中...' ||
                        t.pz === '正在办理中...'
                      "
                    ></i>
                    <i class="iconfont icon-queding" v-else></i>
                  </div>
                  <div class="spFlow-text">
                    <div>
                      <span>{{ t.ry }}</span>
                    </div>
                    <div>{{ t.time }}</div>
                    <div>{{ t.cz }}：{{ t.pz }}</div>
                  </div>
                </li>
              </template>
              <template v-else>
                <li v-for="(t, index) in pzInfo" :key="'k' + index">
                  <div :class="t.ry.yd > 2 ? 'spFlow-img2' : 'spFlow-img'">
                    <div style="color: #00ff00">
                      {{ t.yd.substr(0, 2) }}
                      <span v-if="t.yd.length > 2"
                        ><br />{{ t.yd.substr(2) }}</span
                      >
                    </div>
                    <i
                      class="wait"
                      v-if="
                        t.pz === '正在审核中...' ||
                        t.pz === '正在查看中...' ||
                        t.pz === '正在审批中...' ||
                        t.pz === '正在办理中...'
                      "
                    ></i>
                    <i class="iconfont icon-queding" v-else></i>
                  </div>
                  <div class="spFlow-text">
                    <div>
                      <span>{{ t.ry }}</span>
                    </div>
                    <div>{{ t.time }}</div>
                    <div>已撤销</div>
                  </div>
                </li>
              </template>
              <li v-if="retreatInfo.type == '退回' && false">
                <div
                  :class="
                    retreatInfo.thTaskName.length > 2
                      ? 'spFlow-img2'
                      : 'spFlow-img'
                  "
                >
                  <div style="color: #00ff00">
                    {{ retreatInfo.thTaskName.substr(0, 2) }}
                    <span v-if="retreatInfo.thTaskName.length > 2"
                      ><br />{{ retreatInfo.thTaskName.substr(2) }}</span
                    >
                  </div>
                  <i class="iconfont icon-guanbi"></i>
                </div>
                <div class="spFlow-text">
                  <div>
                    <span>{{ retreatInfo.userName }}</span>
                  </div>
                  <div>
                    {{ $moment(retreatInfo.tgTime).format("YYYY-MM-DD HH:mm") }}
                  </div>
                  <div>未通过</div>
                </div>
              </li>
              <li
                v-for="(t, index) in wfYwStreamTemp"
                :key="'l' + index + 1000000"
              >
                <div
                  :class="t.taskName.length > 2 ? 'spFlow-img2' : 'spFlow-img'"
                >
                  <div style="color: #ffffff">
                    {{ t.taskName.substr(0, 2) }}
                    <span v-if="t.taskName.length > 2"
                      ><br />{{ t.taskName.substr(2) }}</span
                    >
                  </div>
                </div>
                <div class="spFlow-text">
                  <div>
                    <span>{{ t.userName }}</span>
                  </div>
                  <div>等待办理..</div>
                </div>
              </li>
            </ul>
          </div>
        </div> -->
      </el-tab-pane>
    </el-tabs>
    <el-footer style="margin-top: 10px; padding: 0; z-index: 100 !important">
      <span style="margin-top: 20px; display: block" class="dialog-footer">
        <!-- 左 -->
        <span style="float: left">
          <span
            v-show="mode == '办理' && activeName == '0'"
            style="margin-right: 10px"
          >
            <el-button
              @click="goback()"
              v-show="dqTask.backSwitch"
              type="warning"
              >退回</el-button
            >
            <!--             <el-button @click="transfer()" v-show="dqTask.transferSwitch" type="primary">转办</el-button>-->
            <el-button
              @click="revokeExecute()"
              icon="el-icon-delete-solid"
              v-show="dqTask.revokeSwitch"
              type="danger"
              >撤销</el-button
            >
          </span>
          <span
            v-show="
              mode == '查看' &&
              wfYwMain.ywState == '办理中' &&
              activeName == '0'
            "
          >
            <!--             <el-button @click="recallExecute()" v-show="recallId!=''" type="danger">撤回</el-button>-->
          </span>
          <span v-show="activeName == '0'">
            <!--            <el-button @click="print()" icon="el-icon-printer" type="primary" v-if="wfFlowConfig.flowDocument!='不打印'" style="margin-right: 10px">打印</el-button>-->
          </span>

          <span
            v-show="
              ywId != null &&
              wfYwMain.flowEdition.indexOf('test') != -1 &&
              activeName == '0'
            "
            style="margin-right: 10px"
          >
            <!--            <el-button @click="delWf()" icon="el-icon-delete" type="danger">删除</el-button>-->
            <!--            <el-button @click="print()" icon="el-icon-printer" type="primary" v-show="wfYwMain.ywState!='已办结'">打印</el-button>-->
          </span>
        </span>

        <!-- 右 -->
        <span style="float: right">
          <span
            v-show="mode == '建立' && activeName == '0'"
            style="margin-right: 10px"
          >
            <el-select
              style="width: 200px; top: -8px"
              v-model="fqRyInfo.bmId"
              v-if="dqRyInfo.userJZ.length > 1"
              @change="selectBm"
              title="您可以选择使用您所兼职的任意部门作为此工作流程的发起部门..."
            >
              <el-option
                v-for="(item, index) in dqRyInfo.userJZ"
                :key="'p' + index"
                :label="item.bmName + '（' + item.userJob + '）'"
                :value="item.bmId"
              ></el-option>
            </el-select>
          </span>
          <span
            v-show="mode == '办理' && activeName == '0'"
            style="margin-right: 10px"
          >
            <span v-show="dqTask.circulateConfig != ''">
              <el-button @click="circulate()" type="success">传阅</el-button>
            </span>
          </span>
          <span
            v-show="(mode == '办理' || mode == '建立') && activeName == '0'"
            style="margin-right: 10px"
          >
            <span style="margin-right: 10px">
              <!--               <el-button @click="Save('save')" type="primary">保存</el-button>-->
            </span>
            <span v-show="dqTask.buttonConfig.length == 0">
              <el-button @click="Save()" type="success">{{
                dqTask.handleButton
              }}</el-button>
            </span>
            <span v-show="dqTask.buttonConfig.length > 0">
              <el-button
                v-for="(item, index) in dqTask.buttonConfig"
                :key="index"
                @click="customButton(item)"
                type="success"
                >{{ item.buttonName }}</el-button
              >
            </span>
          </span>
          <el-button plain type="primary" @click="guanbi()">取消</el-button>
        </span>
      </span>
    </el-footer>
    <el-dialog
      :title="dqTask.handleButton"
      :class="'workflownext' + (nextTask.length == 0 ? '2' : '1')"
      :visible.sync="isNextVisiable"
      width="500"
      :close-on-click-modal="false"
      append-to-body
    >
      <div>
        <el-container>
          <el-main
            class="flowyuanjiao"
            style="height: 200px; padding: 25px"
            v-show="nextTask.length > 0"
          >
            <div v-for="(taskInfo, index) in nextTask" :key="index">
              <el-row style="margin-bottom: 10px">
                传递至【{{ taskInfo.task.taskName }}】进行〖{{
                  taskInfo.task.handleType
                }}〗：
              </el-row>
              <el-row style="margin-bottom: 10px">
                <el-select
                  v-model="taskInfo.selectUserList"
                  placeholder=""
                  :multiple="taskInfo.task.taskType != '普通' ? true : false"
                  style="width: 100%"
                  size="small"
                >
                  <el-option
                    v-for="(item, indexs) in taskInfo.UserList"
                    :key="'a' + indexs"
                    :label="item.name"
                    :value="item.id"
                  >
                  </el-option>
                </el-select>
              </el-row>
            </div>
          </el-main>
          <el-footer
            width="100%"
            style="height: 100px; margin-top: 20px"
            class="flowyuanjiao"
          >
            <div>
              <el-input
                type="textarea"
                v-model="pzText"
                :rows="2"
                style="margin-top: 5px"
                resize="none"
                placeholder="签批意见"
              ></el-input>
            </div>
          </el-footer>
        </el-container>
      </div>
      <el-footer style="float: right; margin-top: 20px" class="dialog-footer">
        <el-button
          @click="nextExecute"
          style="margin-right: 10px"
          type="success"
          :disabled="isDisable"
        >
          {{ dqTask.handleButton }}
        </el-button>
        <el-button @click="isNextVisiable = false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <el-dialog
      title="退回至"
      class="workflownext3"
      :visible.sync="isBackVisiable"
      width="500"
      :close-on-click-modal="false"
      append-to-body
    >
      <div>
        <el-container>
          <el-main
            class="flowyuanjiao"
            style="height: 100px; padding: 25px"
            v-show="backList.length > 0"
          >
            <el-row style="margin-top: 10px">
              <el-select
                v-model="backId"
                placeholder="请选择"
                style="width: 100%"
              >
                <el-option
                  v-for="(item, index) in backList"
                  :key="'c' + index"
                  :label="
                    '【' +
                    item.taskName +
                    '】' +
                    item.blRyName +
                    '〖' +
                    item.blDwName +
                    '-' +
                    item.blBmName +
                    '〗'
                  "
                  :value="item.id"
                >
                </el-option>
              </el-select>
            </el-row>
          </el-main>
          <el-footer
            width="100%"
            style="height: 100px; margin-top: 20px"
            class="flowyuanjiao"
          >
            <div>
              <el-input
                type="textarea"
                v-model="backText"
                :rows="2"
                style="margin-top: 5px"
                resize="none"
                placeholder="退回意见"
              ></el-input>
            </div>
          </el-footer>
        </el-container>
      </div>
      <el-footer
        style="float: right; margin-top: 20px; z-index: 100"
        class="dialog-footer"
      >
        <el-button
          @click="backExecute"
          style="margin-right: 10px"
          type="warning"
          :disabled="isDisable"
          >退回</el-button
        >
        <el-button @click="isBackVisiable = false">取消</el-button>
      </el-footer>
    </el-dialog>
  </el-dialog>
</template>

<script>
import { getObj } from "@/api/admin/user";
import { getObj as getWfConObj } from "@/api/workflow/wfflowconfig";
import { editionObj } from "@/api/workflow/wfflowrelease";
import {
  showProcess
} from '@/api/jiangjin/jiangjinfpjjfpdjb'
import {
  getObj as getWfMainObj,
  streamCy,
  putObj,
  guidObj,
  nextExecute,
  nextStream,
  baskStream,
  revoke,
} from "@/api/workflow/wfywmain";
import { Message } from "element-ui";
import { mapGetters, mapState } from "vuex";
import mainform from "./main";

export default {
  name: "index",
  components: {
    mainform,
  },
  data() {
    return {
      rules: {},
      userId: 0,
      isGZVisiable: false,
      isGZCZVisiable: false,
      ImagePreview: "",
      showType:Boolean,
      gzInfo: { wdxh: 0, qfz: "否" },
      xmData: {
        xmId: null,
        xmName: "",
      },
      xmInfo: [],
      //评论内容
      forumContent: "",
      supportcount: {},
      supportUser: {},
      colorInfo: {
        color1: "#ff6633", //待办节点颜色
        color2: "#8bc561", //已办节点颜色
        color3: "#f6ab00", //当前节点颜色
        color4: "#cccccc", //撤销节点颜色
        color11: "#75D7DA", //待办线路颜色
        color12: "#FFCCFF", //已办线路颜色
        color21: "#000000", //线路文字颜色
      },
      wfYwStreamTemp: [],
      isDisable: false,
      selectUserList: null,
      operation: null,
      upReturnData: null,
      activeName: "0",
      clientHeight: 600,
      isVisiable: false,
      isNextVisiable: false,
      imgSvgProcess: 0,
      // form: { selectIds: [], selectNames: "" },
      form: { selectIds: [], selectNames: [] },
      isBackVisiable: false,
      isTransferVisiable: false,
      isCirculateVisiable: false,
      dqRyInfo: {
        //当前人员信息
        dwId: "", //单位ID
        dwName: "", //单位名称
        bmId: "", //部门ID
        bmName: "", //部门名称
        userId: "", //用户ID
        userName: "", //用户姓名
        userJob: "", //用户职务
        userRole: [], //用户角色
        userJZ: [], //用户兼职
      },
      fqRyInfo: {
        //发启人员信息
        dwId: "", //单位ID
        dwName: "", //单位名称
        bmId: "", //部门ID
        bmName: "", //部门名称
        userId: "", //用户ID
        userName: "", //用户姓名
        userJob: "", //用户职务
        userRole: [], //用户角色
        userJZ: [], //用户兼职
      },
      dialogTitle: "表单信息",
      pzInfo: [
        //批注时间线
        // {
        //     yd:"受理",
        //     cz:"申请",
        //     time:"2019-05-05 18:24",
        //     ry:"王大一",
        //     pz:"已按要求填写申请单，并上传附件。"
        // }
      ],
      mode: "", //模式：建立、办理、查看
      wfFlowConfig: {}, //流程主信息
      wfFlowRelease: {}, //发布流程信息
      wholeConfig: {}, //发布流程配置信息
      flowTemplate: [], //业务流程模板
      GUID: "", //工作流程唯一标识
      ywId: null, //业务ID
      fcId: null, //工作流ID
      formData: null, //表单数据
      flowConfigLine: null, //流程图线路表
      flowConfigNode: null, //流程图节点表
      flowConfigGateway: null, //流程图分支表
      flowInfoSvg: "", //流程图
      imgSvg: "", //流程图BASEd64
      formInfo: [], //表单
      formInfoDetailed: [], //明细表单
      formOrProgram: "", //是否公共表单
      programInterface: "", //程序接口,
      dqTask: {
        //操作节点ID
        attachmentHeight: 70,
        attachFileConfig: [],
        buttonConfig: [],
      },
      wfYwMain: {}, //业务主表
      wfYwStream: [], //业务流转表
      wfYwStreams: {}, //业务流转表临时
      dqYwStream: {
        //当前业务节点
        ywId: 0,
        id: 0,
      },
      retreatInfo: {
        //退回转办信息
        type: "",
        thStId: 0,
        thTaskId: "",
        thTaskName: "",
        userId: 0,
        userName: "",
        tgTime: 0,
        tgMessage: "",
      },
      // 评论相关
      pageProperty: {
        // 共多少条数据
        totalElements: 0,
        // 当前所在页
        page: 1,
        // 一页显示的条数
        size: 7,
        // 排序字段
        sort: "creationTime",
        // 排序方向
        dir: "desc",
      },
      forumData: [],
      attachFileList: [], //附件列表
      recordList: [], //日志列表
      nextTask: [],
      pzText: "", //批注信息
      streamTaskId: "", //指定下一步节点
      backList: [], //可退回列表
      backText: "", //退回说明
      backId: "", //退回节点
      recallId: "", //撤回ID
      transferUserList: [], //转办用户列表
      transferUserId: "", //转办用户
      transferText: "", //转办说明
      circulateUserList: [], //传阅用户列表
      circulateUserId: [], //传阅用户
      circulateText: "", //传阅说明
      openFileType: "", //打开文件类型
      openFileOut: {
        //打开输出文件信息
      },
      openFileIn: {
        //打开输出文件信息
      },
      options: {
        toolbar: true,
        title: true,
        url: "data-source",
      },
      vdisabled: false,
      btnBoxBg: "", //附件点击后颜色
      jdqc: "",
      actPicUrl:"",
      taskId:"",
    };
  },
  watch: {
    activeName: function (val) {
      if (val == "0") {
        this.openFileType = "";
        this.getInfo();
      }
      if(val == 2){
        this.viewPic(this.taskId)
      }
      console.log(val)
    },
    // newBmid(val, oldVal) {
    //   if (oldVal) {
    //     if (val != oldVal) {
    //       this.againSvg();
    //     }
    //   }
    // },
  },
  computed: {
    ...mapGetters(["permissions"]),
    ...mapState({
      userInfo: (state) => state.user.userInfo,
    }),
    newBmid() {
      return this.fqRyInfo.bmId;
    },
    dianzan() {
      return this.supportcount.userzj == 0 ? "color:#424242" : "color:#0961bc";
    },
  },
  mounted() {
    this.userId = this.userInfo.userId;
  },
  created: function () {},
  methods: {
    getXmInfo() {
      this.xmInfo = [];
    },
    getAttachFileAllImg(ar, fn) {
      //附件筛选所有图片
      var ars = [];
      var img = ["bmp", "jpg", "jpeg", "gif", "png"];
      for (var i in ar) {
        if (
          ar[i].fjName == fn &&
          ar[i].filePreview &&
          img.indexOf(ar[i].filePreview.split(".")[1].toLowerCase()) != -1
        ) {
          ars.push(ar[i]);
        }
      }
      return ars;
    },
    btuRemove(value) {
      var tagList = this.form.selectIds;
      for (var i = 0; i < tagList.length; i++) {
        if (tagList[i].id === value) {
          tagList.splice(i, 1);
        }
      }
      this.form.selectIds = tagList;
    },
    // 关闭
    guanbi() {
      this.isVisiable = false;
      // Bus.$emit("workflowDBList", "1");
      // Bus.$emit("workflowWQDDList", "1");//我启动的
      // Bus.$emit("workflowWBLDList", "1");//我办理的
      // Bus.$emit("workflowCSWDList", "1");//抄送我的
      // Bus.$emit("adminRefresh", "1");
    },
    init() {
      return new Promise((resolve, reject) => {
        //表单清空
        this.isVisiable = true;
        this.isNextVisiable = false;
        this.isBackVisiable = false;
        this.isTransferVisiable = false;
        this.isCirculateVisiable = false;
        this.operation = null;
        this.upReturnData = null;
        this.activeName = "0";
        this.wfYwStreamTemp = [];
        this.clientHeight = document.documentElement.clientHeight;
        this.dqRyInfo = {
          dwId: "",
          dwName: "",
          bmId: "",
          bmName: "",
          userId: "",
          userName: "",
          userJob: "",
          userRole: [],
          userJZ: [],
        };
        this.fqRyInfo = {
          dwId: "",
          dwName: "",
          bmId: "",
          bmName: "",
          userId: "",
          userName: "",
          userJob: "",
          userRole: [],
          userJZ: [],
        };
        this.dialogTitle = "表单信息";
        this.pzInfo = [];
        this.mode = "";
        this.wfFlowConfig = {};
        this.wfFlowRelease = {};
        this.wholeConfig = {};
        this.flowTemplate = [];
        this.GUID = "";
        this.ywId = null;
        this.fcId = null;
        this.formData = null;
        this.flowConfigLine = null;
        this.flowConfigNode = null;
        this.flowConfigGateway = null;
        this.flowInfoSvg = "";
        this.imgSvg = "";
        this.formInfo = [];
        this.formInfoDetailed = [];
        this.formOrProgram = "";
        this.programInterface = "";
        this.dqTask = {
          attachFileConfig: [],
          buttonConfig: [],
        };
        this.wfYwMain = {};
        this.wfYwStream = [];
        this.wfYwStreams = {};
        this.dqYwStream = {
          ywId: 0,
          id: 0,
        };

        this.retreatInfo = {
          type: "",
          thStId: 0,
          thTaskId: "",
          thTaskName: "",
          userId: 0,
          userName: "",
          tgTime: 0,
          tgMessage: "",
        };
        this.attachFileList = [];
        this.recordList = [];
        this.nextTask = [];
        this.pzText = "";
        this.streamTaskId = "";
        this.backList = [];
        this.backText = "";
        this.backId = "";
        this.recallId = "";
        this.transferUserList = [];
        this.transferUserId = "";
        this.transferText = "";
        this.circulateUserList = [];
        this.circulateUserId = [];
        this.circulateText = "";
        this.openFileType = "";
        this.openFileOut = {};
        this.openFileIn = {};
        this.jdqc = "";
        (this.xmData = { xmId: null, xmName: "" }),
          (this.xmInfo = []),
          this.watermark(
            this.userInfo.ryName +
              "【" +
              this.userInfo.username +
              "-" +
              this.userInfo.deptCode +
              "】"
          );
        resolve();
        this.getXmInfo();
      });
    },
    async open(ywId,id,ids) {
      // asss
      showProcess(ids).then(res=>{
        console.log(res)
        this.showType = res.data.data;
      })
      await this.init();
      this.taskId = id
      this.viewPic(this.taskId)
      //获取工作流信息
      await this.getYwMain(ywId);
      this.ywId = ywId;
      this.fcId = this.wfYwMain.flowId;
      this.GUID = this.wfYwMain.guid;
      this.formData = JSON.parse(this.wfYwMain.formData);
      this.xmData.xmId = this.wfYwMain.xmId;
      this.xmData.xmName = this.wfYwMain.xmName;
      //获取流程配置
      await this.getFlowConfig(this.wfYwMain.flowId);
      this.dialogTitle = "" + this.wfFlowConfig.flowName + "信息";

      //获取版本配置
      await this.getFlowEdition(
        this.wfYwMain.flowId,
        this.wfYwMain.flowEdition
      );

      //获取当前人信息
      getObj(this.userInfo.userId).then((res) => {
        this.dqRyInfo = {
          dwId: res.data.data.orgaId * 1,
          dwName: res.data.data.orgaName,
          bmId: res.data.data.deptId * 1,
          bmName: res.data.data.deptName,
          userId: res.data.data.userId * 1,
          userName: res.data.data.ryName,
          userJob: res.data.data.ryZw,
          userRole: res.data.data.roleList,
          userJZ: [],
        };

        //获取发启人信息
        this.fqRyInfo = {
          dwId: this.wfYwMain.fqDwId * 1,
          dwName: this.wfYwMain.fqDwName,
          bmId: this.wfYwMain.fqBmId * 1,
          bmName: this.wfYwMain.fqBmName,
          userId: this.wfYwMain.fqRyId * 1,
          userName: this.wfYwMain.fqRyName,
        };

        var task1 = []; //已完成
        var task2 = []; //办理中
        var task3 = []; //当前节点

        //确定操作模式
        if (this.wfYwMain.ywState == "办理中") {
          var db = []; //当前人待办
          var dball = []; //所有待办
          //确定操作节点
          for (var x in this.wfYwStream) {
            if (this.wfYwStream[x].jsTime == null) {
              dball.push(this.wfYwStream[x]);
              if (
                this.userInfo.userId == this.wfYwStream[x].blRyId ||
                this.userInfo.userId == this.wfYwStream[x].sqRyId
              ) {
                db.push(this.wfYwStream[x]);
              }
              this.hxStream(this.wfYwStream[x].taskId);
            }
            this.wfYwStreams[this.wfYwStream[x].id] = this.wfYwStream[x];
          }
          if (db.length == 0) {
            this.mode = "查看";
            if (dball.length > 0) {
              var recallIds = [];
              for (var i in dball) {
                var x = dball[i].pid;
                if (x == 0) {
                  break;
                }
                if (this.flowConfigNode[dball[i].taskId].recallSwitch) {
                  if (
                    this.userInfo.userId == this.wfYwStreams[x].blRyId ||
                    this.userInfo.userId == this.wfYwStreams[x].sqRyId
                  ) {
                    if (recallIds.indexOf(x) == -1) {
                      recallIds.push(x);
                    }
                  }
                }
              }
              for (var i = recallIds.length - 1; i >= 0; i--) {
                for (var x in this.wfYwStream) {
                  if (
                    this.wfYwStream[x].pid == recallIds[i] &&
                    this.wfYwStream[x].jsTime != null
                  ) {
                    recallIds.splice(i, 1);
                    break;
                  }
                }
              }
              if (recallIds.length > 0) {
                this.recallId = recallIds[0];
              }
            }
          } else {
            if (db.length == 1) {
              this.mode = "办理";
              this.dqTask = this.flowConfigNode[db[0].taskId];
              task3.push(db[0].taskId);
              this.dqYwStream = db[0];
            } else {
              //多个待办节点处理
              this.mode = "办理";
              this.dqTask = this.flowConfigNode[db[0].taskId];
              task3.push(db[0].taskId);
              this.dqYwStream = db[0];
            }
            if (this.dqYwStream.retreatInfo != null) {
              this.retreatInfo = JSON.parse(this.dqYwStream.retreatInfo);
            }
            if (this.dqYwStream.cyTime == null) {
              //更新查阅时间
              streamCy(this.dqYwStream.id)
                .then((res) => {
                  if (res.data.code == "0") {
                  } else {
                    Message({
                      message: res.msg,
                      type: "error",
                      duration: 3 * 1000,
                    });
                  }
                })
                .catch((error) => {
                  //console.log(error);
                });
            }
          }
          //初始表单信息
          this.initForm();

          //初始化附件
        } else {
          this.mode = "查看";
          this.initForm();
          //初始化附件
        }
        //初始流转信息
        for (var x in this.wfYwStream) {
          var timeLimit = "无时限";
          for (var d in this.flowConfigNode) {
            if (this.wfYwStream[x].taskId == d) {
              var data =
                this.flowConfigNode[d].timeLimit == 0
                  ? "无时限"
                  : this.flowConfigNode[d].timeLimit + "小时";
              timeLimit = data;
            }
          }
          var sfyq = "未逾期";
          if (
            this.wfYwStream[x].dqTime != null &&
            this.wfYwStream[x].dqTime != ""
          ) {
            if (this.wfYwStream[x].jsTime > this.wfYwStream[x].dqTime) {
              sfyq = "逾期";
            }
            if (
              new Date().getTime() > this.wfYwStream[x].dqTime &&
              this.wfYwStream[x].jsTime == null
            ) {
              sfyq = "逾期";
            }
          }
          this.pzInfo.push({
            yd: this.wfYwStream[x].taskName,
            cz: this.wfYwStream[x].taskCz,
            dqTime: this.wfYwStream[x].dqTime,
            sfyq: sfyq,
            time: this.$moment(
              this.wfYwStream[x].jsTime == null
                ? this.wfYwStream[x].ksTime
                : this.wfYwStream[x].jsTime
            ).format("YYYY-MM-DD HH:mm"),
            ry: this.wfYwStream[x].blRyName,
            pz:
              this.wfYwStream[x].taskPz == null
                ? "正在" + this.wfYwStream[x].taskCz + "中..."
                : this.wfYwStream[x].taskPz,
            info: this.wfYwStream[x],
            //timeLimit: timeLimit
          });
          if (this.wfYwStream[x].jsTime != null) {
            task1.push(this.wfYwStream[x].taskId);
          } else if (this.wfYwStream[x].ksTime != null) {
            task2.push(this.wfYwStream[x].taskId);
          }
        }

        //初始图形信息
        this.setSvg(this.flowInfoSvg, task1, task2, task3);

      });
      this.getForumData();
      this.getSupportcount();
    },
    hxStream(id) {
      //处理自己下一条
      let config = this.flowConfigLine[id];
      if (config.outgoing) {
        let nextId;
        if (typeof config.outgoing === "string") {
          nextId = config.outgoing;
        } else {
          nextId = config.outgoing[0];
        }
        this.hxStream(nextId);
      } else if (config.targetRef) {
        let nextId = config.targetRef;
        let next = this.flowConfigLine[nextId];
        if (next.type == "Task") {
          let task = this.flowConfigNode[nextId];
          let userName = "相关领导";
          if (task.personnelConfig.type == "指定人员") {
            userName = task.personnelConfig.users[0].ryName;
          }
          this.wfYwStreamTemp.push({
            taskId: task.taskId,
            taskName: task.taskName,
            userName: userName,
            UserList: [],
          });
        }
        this.hxStream(config.targetRef);
      }

      // this.wfYwStreamTemp.push({
      //   taskId: nextInfo[i].TaskId,
      //   taskName: this.flowConfigLine[nextInfo[i].TaskId].name,
      //   userName: userName,
      //   UserList: nextInfo[i].UserList,
      // });

      //处理后续
    },
    editEdition() {},
    async create(fcId, ywId, formData) {},
    async test(fcId, testVer) {},
    initForm() {
      this.$set(this.dqYwStream, "flowId", this.fcId);
      //console.log(this.mode)
      //初始表单信息
      if (this.mode == "查看") {
        this.$refs.mainform.init(
          this.formOrProgram,
          this.formInfo,
          this.formInfoDetailed,
          this.programInterface,
          this.formData,
          this.GUID,
          this.wfYwMain,
          this.wfYwStream,
          this.dqYwStream,
          this.dqTask
        );
      } else {
        this.$refs.mainform.init(
          this.dqTask.formOrProgram,
          this.dqTask.formInfo,
          this.dqTask.formInfoDetailed,
          this.dqTask.programInterface,
          this.formData,
          this.GUID,
          this.wfYwMain,
          this.wfYwStream,
          this.dqYwStream,
          this.dqTask
        );
      }
    },
    getFlowConfig(fcId) {
      //获取流程配置
      return new Promise((resolve, reject) => {
        getWfConObj(fcId)
          .then((res) => {
            this.wfFlowConfig = res.data.data;
            resolve();
          })
          .catch((error) => {
            //console.log(error);
            reject(error);
          });
      });
    },
    getFlowEdition(fcId, flowEdition) {
      return new Promise((resolve, reject) => {
        editionObj(flowEdition)
          .then((res) => {
            this.wfFlowRelease = res.data.data;
            //console.log("this.wfFlowRelease:"+this.wfFlowRelease)
            this.wholeConfig = JSON.parse(this.wfFlowRelease.wholeConfig);
            this.flowTemplate = JSON.parse(this.wholeConfig.flowTemplate);
            this.flowConfigLine =
              this.wholeConfig.flowConfigLine == null
                ? null
                : JSON.parse(this.wholeConfig.flowConfigLine);
            this.flowConfigNode =
              this.wholeConfig.flowConfigNode == null
                ? null
                : JSON.parse(this.wholeConfig.flowConfigNode);

            this.flowConfigGateway =
              this.wholeConfig.flowConfigGateway == null
                ? null
                : JSON.parse(this.wholeConfig.flowConfigGateway);
            this.flowInfoSvg = this.wholeConfig.flowInfoSvg;
            this.formInfo =
              this.wholeConfig.formInfo == null
                ? []
                : JSON.parse(this.wholeConfig.formInfo);
            this.formInfoDetailed =
              this.wholeConfig.formInfoDetailed == null
                ? []
                : JSON.parse(this.wholeConfig.formInfoDetailed);
            this.formOrProgram = this.wholeConfig.formOrProgram;
            this.programInterface = this.wholeConfig.programInterface;
            resolve();
          })
          .catch((error) => {
            //console.log(error);
            reject(error);
          });
      });
    },
    getYwMain(ywId) {
      //获取业务主表
      return new Promise((resolve, reject) => {
        getWfMainObj(ywId)
          .then((res) => {
            this.wfYwMain = res.data.data.wfYwMain;
            this.wfYwStream = res.data.data.wfYwStream;
            resolve();
          })
          .catch((error) => {
            //console.log(error);
            reject(error);
          });
      });
    },
    getInfo() {
      //获取业务详细信息
      guidObj(this.GUID)
        .then((res) => {
          if (res.data.code == "0") {
            if (res.data.data != null) {
              this.wfYwMain = res.data.data.wfYwMain;
            }
            //this.attachFileList = res.pra.wfYwAttachfile;
            this.recordList = res.data.data.wfYwRecord;
          } else {
            Message({
              message: res.msg,
              type: "error",
              duration: 3 * 1000,
            });
          }
        })
        .catch((error) => {
          //console.log(error);
        });
    },
    nextExecute() {
      //执行下一下
      this.isDisable = true;
      setTimeout(() => {
        this.isDisable = false;
      }, 1000);
      //信息验证
      if (this.pzText == "") {
        if (this.dqTask.TextSwitch) {
          Message({
            message: "请您填写签批意见信息...",
            type: "error",
            duration: 3 * 1000,
          });
          return;
        }
      }
      for (var i in this.nextTask) {
        var selectUser = this.nextTask[i].selectUserList;
        if (typeof selectUser == "string") {
          if (selectUser == "") {
            Message({
              message:
                "【" +
                this.nextTask[i].task.taskName +
                "】环节没有选择办理人员...",
              type: "error",
              duration: 3 * 1000,
            });
            return;
          }
        } else {
          if (selectUser.length == 0) {
            Message({
              message:
                "【" +
                this.nextTask[i].task.taskName +
                "】环节没有选择办理人员...",
              type: "error",
              duration: 3 * 1000,
            });
            return;
          }
        }
      }

      var info = {};
      info.id = this.dqYwStream.id;
      info.pzText = this.pzText;
      info.nextInfo = JSON.stringify(this.nextTask);
      info.userIds = "";
      var ArrayIds = [];
      if (this.form.selectIds.length > 0) {
        for (var i in this.form.selectIds) {
          ArrayIds.push(this.form.selectIds[i].id);
        }
        info.userIds = ArrayIds.join(",");
      }
      nextExecute(info)
        .then((res) => {
          if (res.data.code == "0") {
            Message({
              message: this.dqTask.handleButton + "成功",
              type: "success",
              duration: 3 * 1000,
            });
            this.open(this.ywId);
            this.$emit("refreshDataList");
          } else {
            Message({
              message: res.msg,
              type: "error",
              duration: 3 * 1000,
            });
          }
        })
        .catch((error) => {
          //console.log(error);
        });
    },
    viewPic (taskId) {
      this.actPicUrl = `/act/task/view/` +taskId;
    },
    getNextTask(UserList, taskId, skipList) {
      var idList = [];
      let ids = [];
      for (var j in UserList) {
        UserList[j].id =
          UserList[j].dwId + "-" + UserList[j].bmId + "-" + UserList[j].userId;
        UserList[j].name =
          UserList[j].userName +
          "〖" +
          UserList[j].dwName +
          "-" +
          UserList[j].bmName +
          "〗";
        if (UserList[j].userJob != null && UserList[j].userJob != "") {
          UserList[j].name += "【" + UserList[j].userJob + "】";
        }
        if (idList.indexOf(UserList[j].userId) != -1) {
          if (this.flowConfigNode[taskId].taskType != "普通") {
            continue;
          }
        }
        idList.push(UserList[j].userId);
        ids.push(UserList[j].id);
      }
      return {
        task: this.flowConfigNode[taskId],
        UserList: UserList,
        selectUserList:
          this.flowConfigNode[taskId].taskType != "普通"
            ? ids
            : ids.length == 1
            ? ids[0]
            : "",
        skipList: skipList,
      };
    },
    nextStream() {
      // return;
      //手机同步
      let skipSwitch = false;
      let skipList = [];
      let nextTask = [];
      if (this.dqTask.skipSwitch) {
        //当前环节可以去重
        for (var i in this.wfYwStreamTemp) {
          var UserList = this.wfYwStreamTemp[i].UserList;
          var usertf = false;
          for (var j in UserList) {
            if (UserList[j].userId == this.userInfo.userId) {
              usertf = true;
              break;
            }
          }
          if (usertf) {
            if (this.flowConfigNode[this.wfYwStreamTemp[i].taskId].skipSwitch) {
              skipSwitch = true;
              skipList.push(this.wfYwStreamTemp[i].taskId);
            } else {
              nextTask.push(
                this.getNextTask(
                  UserList,
                  this.wfYwStreamTemp[i].taskId,
                  skipList
                )
              );
              break;
            }
          } else {
            nextTask.push(
              this.getNextTask(
                UserList,
                this.wfYwStreamTemp[i].taskId,
                skipList
              )
            );
            break;
          }
        }
      }
      if (skipSwitch) {
        this.isNextVisiable = true;
        this.pzText = this.dqTask.handleText + "";
        this.nextTask = nextTask;
      } else {
        //获取下一步信息
        nextStream(
          this.dqYwStream.id,
          this.streamTaskId == "" ? "noValue" : this.streamTaskId
        )
          .then((res) => {
            if (res.data.code == "0") {
              this.isNextVisiable = true;
              this.pzText = this.dqTask.handleText + "";
              this.nextTask = [];
              for (var i in res.data.data) {
                var idList = [];
                var ids = [];
                for (var j in res.data.data[i].UserList) {
                  var UserList = res.data.data[i].UserList[j];
                  UserList.id =
                    UserList.dwId + "-" + UserList.bmId + "-" + UserList.userId;
                  UserList.name =
                    UserList.userName +
                    "〖" +
                    UserList.dwName +
                    "-" +
                    UserList.bmName +
                    "〗";
                  if (UserList.userJob != null && UserList.userJob != "") {
                    UserList.name += "【" + UserList.userJob + "】";
                  }
                  if (idList.indexOf(UserList.userId) != -1) {
                    if (
                      this.flowConfigNode[res.data.data[i].TaskId].taskType !=
                      "普通"
                    ) {
                      continue;
                    }
                  }
                  idList.push(UserList.userId);
                  ids.push(UserList.id);
                }
                //管理员测试专用
                if (
                  res.data.data[i].UserList.length > 0 &&
                  this.userInfo.userId == 1
                ) {
                  var UserList = JSON.parse(
                    JSON.stringify(res.data.data[i].UserList[0])
                  );
                  UserList.id =
                    this.dqRyInfo.dwId +
                    "-" +
                    this.dqRyInfo.bmId +
                    "-" +
                    this.dqRyInfo.userId;
                  UserList.userId = this.dqRyInfo.userId;
                  UserList.userName = this.dqRyInfo.userName;
                  ids.push(UserList.id);
                  UserList.name =
                    this.dqRyInfo.userName +
                    "〖" +
                    this.dqRyInfo.dwName +
                    "-" +
                    this.dqRyInfo.bmName +
                    "〗【管理员】";
                  res.data.data[i].UserList.push(UserList);
                }
                //测试流程专用
                if (
                  res.data.data[i].UserList.length > 0 &&
                  this.wfYwMain.flowEdition.indexOf("test") != -1
                ) {
                  var UserList = JSON.parse(
                    JSON.stringify(res.data.data[i].UserList[0])
                  );
                  UserList.id =
                    UserList.dwId +
                    "-" +
                    UserList.bmId +
                    "-" +
                    this.dqRyInfo.userId;
                  UserList.userId = this.dqRyInfo.userId;
                  UserList.userName = this.dqRyInfo.userName;
                  ids.push(UserList.id);
                  UserList.name =
                    this.dqRyInfo.userName +
                    "〖" +
                    UserList.dwName +
                    "-" +
                    UserList.bmName +
                    "〗【管理员】";
                  res.data.data[i].UserList.push(UserList);
                }
                this.nextTask.push({
                  task: this.flowConfigNode[res.data.data[i].TaskId],
                  UserList: res.data.data[i].UserList,
                  selectUserList:
                    this.flowConfigNode[res.data.data[i].TaskId].taskType !=
                    "普通"
                      ? ids
                      : ids.length == 1
                      ? ids[0]
                      : "",
                });
              }
            } else {
              Message({
                message: res.msg,
                type: "error",
                duration: 3 * 1000,
              });
            }
          })
          .catch((error) => {
            //console.log(error);
          });
      }
    },
    async nextSave(x) {
      //进行下一步前保存信息
      this.operation = (formData) => {
        //进行附件验证
        var fjMessage = "";
        var pd = "";
        for (var index in this.dqTask.attachFileConfig) {
          if (this.dqTask.attachFileConfig[index].fjXz == "是") {
            for (var index1 in this.attachFileList) {
              if (
                this.attachFileList[index1].fjName ==
                this.dqTask.attachFileConfig[index].fjName
              ) {
                pd = "存在";
              }
            }
            if (pd == "") {
              fjMessage = this.dqTask.attachFileConfig[index].fjName;
              break;
            }
            pd = "";
          }
        }
        if (x != "save") {
          if (fjMessage != "") {
            Message({
              message: "请在" + fjMessage + "中添加附件",
              type: "error",
              duration: 3 * 1000,
            });
            return;
          }
        }
        this.formData = formData;
        this.operation = async (formDatas) => {
          this.formData = formDatas;
          putObj({
            id: this.ywId,
            formData: JSON.stringify(formDatas),
          })
            .then((res) => {
              if (res.data.code == "0") {
                //同步数据表
                this.SaveForm();
                if (x == "save") {
                } else {
                  this.nextStream();
                }
              } else {
                Message({
                  message: res.msg,
                  type: "error",
                  duration: 3 * 1000,
                });
              }
            })
            .catch((error) => {
              //console.log(error);
            });
        };
        this.valiFormData(formData); //验证表单数据
      };
      this.getFormData(); //获取表单数据
    },
    customButton(button) {
      //自定义按钮处理
      if (button.buttonType == "传递") {
        this.Save(button.taskId);
      }
      if (button.buttonType == "保存") {
        this.Save("save");
      }
    },
    SaveForm() {},
    getForumData() {},
    subForum() {},
    getSupportcount() {},
    subSupport() {},
    handleClicks(page) {
      // 当前页改变时触发，获取所改变页的数据
      this.pageProperty.page = page;
      this.getForumData();
    },
    handleSizeChanges(size) {
      // 当前页显示数据条数改变时触发，重新获取数据
      this.pageProperty.size = size;
      this.getForumData();
    },
    Save(streamTaskId) {
      //保存
      if (streamTaskId && streamTaskId != "save") {
        this.streamTaskId = streamTaskId;
      } else {
        this.streamTaskId = "";
      }
      if (this.mode == "办理") {
        if (streamTaskId == "save") {
          this.nextSave("save");
        } else {
          this.nextSave();
        }
      }
      if (this.mode == "建立") {
        if (streamTaskId == "save") {
          this.createSave("save");
        } else {
          this.createSave();
        }
      }
    },
    async createSave(y) {
      //建立业务
    },
    valiFormData(data) {
      //验证表单数据
      this.operation(data);
    },
    getFormData() {
      if (
        this.formOrProgram == "说明展示" ||
        this.dqTask.formOrProgram == "说明展示"
      ) {
        this.operation(this.formData);
      } else {
        //获取表单数据
        this.$refs.mainform.getFormData();
      }
    },
    returnFormData(data) {
      //表单数据返回
      this.operation(data);
    },
    upAttachFile(attachFile) {},
    uploadData(data) {
      //附件数据返回
      this.upReturnData(data);
    },
    delAttachFile(File) {},
    circulate() {},
    circulateExecute() {},
    transfer() {},
    transferExecute() {},
    goback() {
      //激活退回
      var backList = [];
      for (var i in this.wfYwStream) {
        // if (
        //   this.dqYwStream.taskId == this.wfYwStream[i].taskId &&
        //   this.wfYwStream[i].jsTime != null
        // ) {
        //   Message({
        //     message: "此办理节点上已经有其他人完成操作，无法执行退回...",
        //     type: "error",
        //     duration: 3 * 1000,
        //   });
        //   return;
        // }
        if (this.dqTask.backList.indexOf(this.wfYwStream[i].taskId) != -1) {
          backList.push(this.wfYwStream[i]);
        }
      }
      if (backList.length == 0) {
        Message({
          message: "没有可以退回的节点，无法执行退回...",
          type: "error",
          duration: 3 * 1000,
        });
      } else {
        this.backList = backList;
        if (backList.length == 1) {
          this.backId = backList[0].id;
        }
        this.isBackVisiable = true;
      }
    },
    revokeExecute() {
      let that = this;
      //撤销执行
      this.$prompt(
        "此操作将作废此工作流程，信息将不可恢复, 请填写撤销原因：",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          inputErrorMessage: "请填写撤销原因",
          inputValidator: (value) => {
            // 点击按钮时，对文本框里面的值进行验证
            if (!value) {
              return "输入不能为空";
            }
          },
        }
      )
        .then(({ value }) => {
          revoke(that.dqYwStream.id, value)
            .then((res) => {
              if (res.data.code == "0") {
                Message({
                  message: "操作成功",
                  type: "success",
                  duration: 3 * 1000,
                });
                that.open(that.ywId);
                that.$emit("refreshDataList");
              } else {
                Message({
                  message: res.msg,
                  type: "error",
                  duration: 3 * 1000,
                });
              }
            })
            .catch((error) => {
              //console.log(error);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消操作",
          });
        });
    },
    recallExecute() {
      //撤回执行
      this.$confirm(
        "操作将工作流程撤回当前环节，中间环节的信息将不可恢复, 是否继续?",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(() => {
          baskStream({
            id: this.recallId,
            backId: this.recallId,
            backType: 2,
            backText: "",
          })
            .then((res) => {
              if (res.data.code == "0") {
                Message({
                  message: "操作成功",
                  type: "success",
                  duration: 3 * 1000,
                });
                this.open(this.ywId);
                this.$emit("refreshDataList");
              } else {
                Message({
                  message: res.msg,
                  type: "error",
                  duration: 3 * 1000,
                });
              }
            })
            .catch((error) => {
              //console.log(error);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消操作",
          });
        });
    },
    delWf() {},
    nextStreamTemp(process, ywMain, ywStream) {},
    updateSvg(process, nextInfo, ywMain, ywStreamLY) {
      var xotree = new XML.ObjTree();
      var cl2 = "#ffccff";

      var line = [];
      var node = [];
      var gate = [];
      line.push(this.flowConfigLine[ywStreamLY.taskId].outgoing[0]);
      var outgoing = this.flowConfigLine[ywStreamLY.taskId].outgoing[0];
      line.push(outgoing);
      var targetRef = this.flowConfigLine[outgoing].targetRef;
      if (this.flowConfigLine[targetRef].type == "endEvent") {
        node.push(targetRef);
      }
      if (this.flowConfigLine[targetRef].type == "ExclusiveGateways") {
        gate.push(targetRef);
        for (var j in this.flowConfigLine[targetRef].outgoing) {
          for (var k in nextInfo) {
            if (
              nextInfo[k].TaskId ==
              this.flowConfigLine[this.flowConfigLine[targetRef].outgoing[j]]
                .targetRef
            ) {
              line.push(this.flowConfigLine[targetRef].outgoing[j]);
            }
          }
        }
      }
      this.forObjSetStyle(
        this.imgSvgObj.svg.g,
        node,
        "fill: " + this.colorInfo.color12 + ";",
        "circle"
      );
      this.forObjSetStyle(
        this.imgSvgObj.svg.g,
        gate,
        "fill: " + this.colorInfo.color12 + ";",
        "polygon"
      );
      this.forObjSetStyleLine(
        this.imgSvgObj.svg.g,
        line,
        this.colorInfo.color12,
        "jt2"
      );

      var str = this.base64Encode(xotree.writeXML(this.imgSvgObj));
      this.imgSvg = "data:image/svg+xml;base64," + str;

      if (nextInfo.length > 0) {
        for (var i in nextInfo) {
          this.forObjSetStyle(
            this.imgSvgObj.svg.g,
            nextInfo[i].TaskId,
            "fill: " + this.colorInfo.color12 + ";",
            "rect"
          );

          var ywStream = {
            id: 0,
            ywId: 0,
            guid: "",
            taskName: "",
            taskId: nextInfo[i].TaskId,
            blDwId: null,
            blDwName: "",
            blBmId: null,
            blBmName: "",
            blRyId: null,
            blRyName: "",
            pid: 0,
          };

          var userName = "【？？？】";

          if (nextInfo[i].UserList.length > 0) {
            ywStream.blDwId = nextInfo[i].UserList[0].dwId;
            ywStream.blBmId = nextInfo[i].UserList[0].bmId;
            ywStream.blRyId = nextInfo[i].UserList[0].userId;

            userName = nextInfo[i].UserList[0].userName;

            if (nextInfo[i].UserList.length > 1) {
              userName = userName + "？";
            }
            userName = "【" + userName + "】";
          }

          //手机同步
          this.wfYwStreamTemp.push({
            taskId: nextInfo[i].TaskId,
            taskName: this.flowConfigLine[nextInfo[i].TaskId].name,
            userName: userName,
            UserList: nextInfo[i].UserList,
          });

          if (this.jdqc.indexOf(nextInfo[i].TaskId) == -1) {
            this.forObjSetStyleText(
              this.imgSvgObj.svg.g,
              nextInfo[i].TaskId,
              userName
            );
            this.jdqc = this.jdqc + nextInfo[i].TaskId + ",";
          }
          var str = this.base64Encode(xotree.writeXML(this.imgSvgObj));
          this.imgSvg = "data:image/svg+xml;base64," + str;

          //this.nextStreamTemp(process, ywMain, ywStream);
        }
      }
    },
    forObjSetStyleText(obj, name, text) {
      //递归设置样式(文字)
      for (var k in obj) {
        //遍历对象和数组
        if (typeof obj[k] == "object") {
          //判断说明如果是对象则递归
          obj[k] = this.forObjSetStyleText(obj[k], name, text);
        } else {
          if (k == "-data-element-id") {
            if (name.indexOf(obj[k]) != -1) {
              var texts = JSON.parse(JSON.stringify(obj["g"]["text"]["tspan"]));
              if (texts.length == undefined) {
                obj["g"]["text"]["tspan"] = [];
                obj["g"]["text"]["tspan"].push(texts);
              }
              var ls = text + "";
              var wz = 0;
              if (ls.indexOf("...") != -1) {
                ls = ls.replace("...", "等");
              }
              if (ls.length == 4) {
                wz = 0;
              }
              if (ls.length == 5) {
                wz = 5;
              }
              if (ls.length == 6) {
                wz = 11.5;
              }
              if (ls.length == 7) {
                wz = 16;
              }
              if (ls.length == 8) {
                wz = 21;
              }
              if (ls.length > 8) {
                wz = 25.5;
              }
              obj["g"]["text"]["tspan"].push({
                "-fill": this.colorInfo.color21,
                "#text": text,
                "-x": 25.5 - wz,
                "-y": "72",
              });
            }
            break;
          }
        }
      }
      return obj;
    },
    backExecute() {
      //退回执行
      this.isDisable = true;
      setTimeout(() => {
        this.isDisable = false;
      }, 1000);
      //信息验证
      if (this.backText == "") {
        Message({
          message: "请您填写退回说明信息...",
          type: "error",
          duration: 3 * 1000,
        });
        return;
      }

      if (this.backId == "") {
        Message({
          message: "请您选择需要退回的环节...",
          type: "error",
          duration: 3 * 1000,
        });
        return;
      }

      this.$confirm(
        "操作将工作流程退回指定环节，中间环节的信息将不可恢复, 是否继续?",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(() => {
          baskStream({
            id: this.dqYwStream.id,
            backId: this.backId,
            backType: 1,
            backText: this.backText,
          })
            .then((res) => {
              if (res.data.code == "0") {
                Message({
                  message: "操作成功",
                  type: "success",
                  duration: 3 * 1000,
                });
                this.open(this.ywId);
              } else {
                Message({
                  message: res.msg,
                  type: "error",
                  duration: 3 * 1000,
                });
              }
            })
            .catch((error) => {
              //console.log(error);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消操作",
          });
        });
    },
    selectBm(bmId) {},
    getUUID(len, radix) {
      //获取UUID
      var chars =
        "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(
          ""
        );
      var uuid = [],
        i;
      radix = radix || chars.length;

      if (len) {
        // Compact form
        for (i = 0; i < len; i++) uuid[i] = chars[0 | (Math.random() * radix)];
      } else {
        // rfc4122, version 4 form
        var r;

        // rfc4122 requires these characters
        uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
        uuid[14] = "4";

        // Fill in random data.  At i==19 set the high bits of clock sequence as
        // per rfc4122, sec. 4.1.5
        for (i = 0; i < 36; i++) {
          if (!uuid[i]) {
            r = 0 | (Math.random() * 16);
            uuid[i] = chars[i == 19 ? (r & 0x3) | 0x8 : r];
          }
        }
      }
      return uuid.join("");
    },
    setSvg(svg, style1, style2, style3) {
      //设置SVGa图片
      if (svg != "") {
        var xotree = new XML.ObjTree();
        var dumper = new JKL.Dumper();
        var tree = xotree.parseXML(svg);
        var json_obj = JSON.parse(dumper.dump(tree));
        var jt0 = JSON.parse(JSON.stringify(json_obj.svg.defs));
        var jt1 = {
          marker: {
            "-id": "jt1",
            "-viewBox": "0 0 20 20",
            "-refX": "11",
            "-refY": "10",
            "-markerWidth": "10",
            "-markerHeight": "10",
            "-orient": "auto",
            path: {
              "-d": "M 1 5 L 11 10 L 1 15 Z",
              "-style":
                "fill: " +
                this.colorInfo.color11 +
                "; stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1; stroke: " +
                this.colorInfo.color11 +
                ";",
            },
          },
        };
        var jt2 = {
          marker: {
            "-id": "jt2",
            "-viewBox": "0 0 20 20",
            "-refX": "11",
            "-refY": "10",
            "-markerWidth": "10",
            "-markerHeight": "10",
            "-orient": "auto",
            path: {
              "-d": "M 1 5 L 11 10 L 1 15 Z",
              "-style":
                "fill: " +
                this.colorInfo.color12 +
                "; stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1; stroke: " +
                this.colorInfo.color12 +
                ";",
            },
          },
        };
        json_obj.svg.defs = [];
        json_obj.svg.defs.push(jt0);
        json_obj.svg.defs.push(jt1);
        json_obj.svg.defs.push(jt2);

        if (style1) {
          if (this.wfYwMain.ywState == "已撤销") {
            this.forObjSetStyle(
              json_obj.svg.g,
              style1,
              "fill: " + this.colorInfo.color4 + ";",
              "rect"
            );
          } else {
            this.forObjSetStyle(
              json_obj.svg.g,
              style1,
              "fill: " + this.colorInfo.color2 + ";",
              "rect"
            );
          }
        }
        if (style2) {
          if (this.wfYwMain.ywState == "已撤销") {
            this.forObjSetStyle(
              json_obj.svg.g,
              style2,
              "fill: " + this.colorInfo.color4 + ";",
              "rect"
            );
          } else {
            this.forObjSetStyle(
              json_obj.svg.g,
              style2,
              "fill: " + this.colorInfo.color1 + ";",
              "rect"
            );
          }
        }
        if (style3) {
          if (this.wfYwMain.ywState == "已撤销") {
            this.forObjSetStyle(
              json_obj.svg.g,
              style3,
              "fill: " + this.colorInfo.color4 + ";",
              "rect"
            );
          } else {
            this.forObjSetStyle(
              json_obj.svg.g,
              style3,
              "fill: " + this.colorInfo.color3 + ";",
              "rect"
            );
          }
        }
        if (this.wfYwMain.ywState != "已撤销") {
          var node = [];
          var gate = [];
          var line = [];
          var nodes = {};
          var nodess = {};
          for (var i in this.wfYwStream) {
            nodes[this.wfYwStream[i].taskId] = this.wfYwStream[i].pid;
            if (nodess[this.wfYwStream[i].taskId] == undefined) {
              nodess[this.wfYwStream[i].taskId] = [];
            }
            nodess[this.wfYwStream[i].taskId].push(this.wfYwStream[i].blRyName);
          }
          if (this.wfYwStream.length > 0) {
            for (var x in this.wfYwStream) {
              var taskId = this.flowConfigLine.StartTask[0];
              if (this.wfYwStream[x].taskId == taskId) {
                node.push(this.flowConfigLine.StartEvent[0]);
                line.push(
                  this.flowConfigLine[this.flowConfigLine.StartEvent[0]]
                    .outgoing
                );
              }
            }
            for (var i in this.wfYwStream) {
              if (this.wfYwStream[i].jsTime == null) {
                break;
              }
              var outgoing =
                this.flowConfigLine[this.wfYwStream[i].taskId].outgoing[0];
              line.push(outgoing);
              var targetRef = this.flowConfigLine[outgoing].targetRef;
              if (this.flowConfigLine[targetRef].type == "endEvent") {
                node.push(targetRef);
              }
              if (this.flowConfigLine[targetRef].type == "ExclusiveGateways") {
                gate.push(targetRef);
                for (var j in this.flowConfigLine[targetRef].outgoing) {
                  if (
                    nodes[
                      this.flowConfigLine[
                        this.flowConfigLine[targetRef].outgoing[j]
                      ].targetRef
                    ] != undefined
                  ) {
                    if (
                      nodes[
                        this.flowConfigLine[
                          this.flowConfigLine[targetRef].outgoing[j]
                        ].targetRef
                      ] == this.wfYwStream[i].id
                    ) {
                      line.push(this.flowConfigLine[targetRef].outgoing[j]);
                    }
                  }
                }
              }
            }
          } else {
            node.push(this.flowConfigLine.StartEvent[0]);
            line.push(
              this.flowConfigLine[this.flowConfigLine.StartEvent[0]].outgoing
            );
          }

          this.forObjSetStyle(
            json_obj.svg.g,
            node,
            "fill: " + this.colorInfo.color2 + ";",
            "circle"
          );
          this.forObjSetStyle(
            json_obj.svg.g,
            gate,
            "fill: " + this.colorInfo.color2 + ";",
            "polygon"
          );
          this.forObjSetStyleLine(
            json_obj.svg.g,
            line,
            this.colorInfo.color2,
            "jt1"
          );

          if (this.mode == "建立") {
            this.forObjSetStyleText(
              json_obj.svg.g,
              this.dqTask.taskId,
              "【" + this.dqRyInfo.userName + "】"
            );
          }

          for (var i in nodess) {
            if (nodess[i].length > 1) {
              if (this.jdqc.indexOf(i) == -1) {
                this.forObjSetStyleText(
                  json_obj.svg.g,
                  i,
                  "【" + nodess[i][0] + "...】"
                );
                this.jdqc = this.jdqc + i + ",";
              }
            } else {
              if (this.jdqc.indexOf(i) == -1) {
                this.forObjSetStyleText(
                  json_obj.svg.g,
                  i,
                  "【" + nodess[i][0] + "】"
                );
                this.jdqc = this.jdqc + i + ",";
              }
            }
          }
        }
        this.imgSvgObjSrc = JSON.parse(JSON.stringify(json_obj));
        this.imgSvgObj = JSON.parse(JSON.stringify(json_obj));
        var str = this.base64Encode(xotree.writeXML(json_obj));
        this.imgSvg = "data:image/svg+xml;base64," + str;
        if (this.mode == "建立") {
          var ywMain = {
            id: 0,
            guid: "",
            ywMainCode: "",
            ywFlowCode: "",
            flowId: this.fcId,
            flowName: "",
            flowEdition: this.wfFlowConfig.flowEdition,
            ywTitle: "",
            ywState: "办理中",
            spState: "",
            formData: "{}",
            fqDwId: this.dqRyInfo.dwId,
            fqDwName: "",
            fqBmId: this.dqRyInfo.bmId,
            fqBmName: "",
            fqRyId: this.dqRyInfo.userId,
            fqRyName: "",
            fqRyInfo: JSON.stringify({
              userJob: this.dqRyInfo.userJob,
              userRole: this.dqRyInfo.userRole,
            }),
            pid: 0,
          };
          var ywStream = {
            id: 0,
            ywId: 0,
            guid: "",
            taskName: "",
            taskId: this.dqTask.taskId,
            blDwId: this.dqRyInfo.dwId,
            blDwName: "",
            blBmId: this.dqRyInfo.bmId,
            blBmName: "",
            blRyId: this.dqRyInfo.userId,
            blRyName: "",
            pid: 0,
          };
          this.nextStreamTemp(0, ywMain, ywStream);
        } else if (this.wfYwMain.ywState == "办理中") {
          for (var i in this.wfYwStream) {
            if (this.wfYwStream[i].jsTime == null) {
              this.nextStreamTemp(0, this.wfYwMain, this.wfYwStream[i]);
            }
          }
        }
      }
    },
    forObjSetStyle(obj, name, styles, type) {
      //递归设置样式
      for (var k in obj) {
        //遍历对象和数组
        if (typeof obj[k] == "object") {
          //判断说明如果是对象则递归
          obj[k] = this.forObjSetStyle(obj[k], name, styles, type);
        } else {
          if (k == "-data-element-id") {
            if (name.indexOf(obj[k]) != -1) {
              obj["g"][type]["-style"] =
                "stroke: black; stroke-width: 2px; " +
                styles +
                " fill-opacity: 1;";
            }
          }
        }
      }
      return obj;
    },
    forObjSetStyleLine(obj, name, styles, type) {
      //递归设置样式(线路)
      for (var k in obj) {
        //遍历对象和数组
        if (typeof obj[k] == "object") {
          //判断说明如果是对象则递归
          obj[k] = this.forObjSetStyleLine(obj[k], name, styles, type);
        } else {
          if (k == "-data-element-id") {
            if (name.indexOf(obj[k]) != -1) {
              obj["g"]["path"]["-style"] =
                "fill: none; stroke-width: 2px; stroke: " +
                styles +
                "; stroke-linejoin: round; marker-end: url('#" +
                type +
                "');";
            }
          }
        }
      }
      return obj;
    },
    changeFormData(data) {
      if (this.flowConfigLine.Gateway.length == 0) {
        return;
      }
      var bdyz = 0;
      for (var i in this.flowConfigLine.Gateway) {
        var Gateway = this.flowConfigGateway[this.flowConfigLine.Gateway[i]];
        var lineData = Gateway.lineData;
        for (var j in lineData) {
          var condition = lineData[j].condition;
          for (var k in condition) {
            var type = condition[k].type;
            if (type == "表单参数") {
              bdyz++;
            }
          }
        }
      }
      if (bdyz == 0) {
        return;
      }
      this.wfYwMain.formData = JSON.stringify(data);
      this.againSvg();
    },
    againSvg() {
      return;
      var xotree = new XML.ObjTree();
      this.imgSvgProcess++;
      this.wfYwStreamTemp = [];
      this.imgSvgObj = JSON.parse(JSON.stringify(this.imgSvgObjSrc));
      var str = this.base64Encode(xotree.writeXML(this.imgSvgObjSrc));
      this.imgSvg = "data:image/svg+xml;base64," + str;

      if (this.mode == "建立") {
        var ywMain = {
          id: 0,
          guid: "",
          ywMainCode: "",
          ywFlowCode: "",
          flowId: this.fcId,
          flowName: "",
          flowEdition: this.wfFlowConfig.flowEdition,
          ywTitle: "",
          ywState: "办理中",
          spState: "",
          formData: this.wfYwMain.formData,
          fqDwId: this.dqRyInfo.dwId,
          fqDwName: "",
          fqBmId: this.dqRyInfo.bmId,
          fqBmName: "",
          fqRyId: this.dqRyInfo.userId,
          fqRyName: "",
          fqRyInfo: JSON.stringify({
            userJob: this.dqRyInfo.userJob,
            userRole: this.dqRyInfo.userRole,
          }),
          pid: 0,
        };
        var ywStream = {
          id: 0,
          ywId: 0,
          guid: "",
          taskName: "",
          taskId: this.dqTask.taskId,
          blDwId: this.dqRyInfo.dwId,
          blDwName: "",
          blBmId: this.dqRyInfo.bmId,
          blBmName: "",
          blRyId: this.dqRyInfo.userId,
          blRyName: "",
          pid: 0,
        };
        this.nextStreamTemp(this.imgSvgProcess, ywMain, ywStream);
      } else if (this.wfYwMain.ywState == "办理中") {
        for (var i in this.wfYwStream) {
          if (this.wfYwStream[i].jsTime == null) {
            this.nextStreamTemp(
              this.imgSvgProcess,
              this.wfYwMain,
              this.wfYwStream[i]
            );
          }
        }
      }
    },
    base64Encode(input) {
      var _keyStr =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
      var output = "";
      var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
      var i = 0;
      input = this._utf8_encode(input);
      while (i < input.length) {
        chr1 = input.charCodeAt(i++);
        chr2 = input.charCodeAt(i++);
        chr3 = input.charCodeAt(i++);
        enc1 = chr1 >> 2;
        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
        enc4 = chr3 & 63;
        if (isNaN(chr2)) {
          enc3 = enc4 = 64;
        } else if (isNaN(chr3)) {
          enc4 = 64;
        }
        output =
          output +
          _keyStr.charAt(enc1) +
          _keyStr.charAt(enc2) +
          _keyStr.charAt(enc3) +
          _keyStr.charAt(enc4);
      }
      return output;
    },
    _utf8_encode(string) {
      string = string.replace(/\r\n/g, "\n");
      var utftext = "";
      for (var n = 0; n < string.length; n++) {
        var c = string.charCodeAt(n);
        if (c < 128) {
          utftext += String.fromCharCode(c);
        } else if (c > 127 && c < 2048) {
          utftext += String.fromCharCode((c >> 6) | 192);
          utftext += String.fromCharCode((c & 63) | 128);
        } else {
          utftext += String.fromCharCode((c >> 12) | 224);
          utftext += String.fromCharCode(((c >> 6) & 63) | 128);
          utftext += String.fromCharCode((c & 63) | 128);
        }
      }
      return utftext;
    },
    toHtml(text) {
      //说明输出
      if (text) {
        return (
          "<span style='margin-left:2em;font-size: 16px;'>" +
          text.replace(
            /\n/g,
            "</span><br><br><span style='margin-left:2em;font-size: 16px;'>"
          ) +
          "</span>"
        );
      } else {
        return "";
      }
    },
    getAttachFile(ar, fn) {
      //附件筛选
      var ars = [];
      for (var i in ar) {
        if (ar[i].fjName == fn && ar[i].stId == this.dqYwStream.id) {
          ars.push(ar[i]);
        }
      }
      return ars;
    },
    getAttachFileAll(ar, fn) {
      //附件筛选所有
      var ars = [];
      for (var i in ar) {
        if (ar[i].fjName == fn) {
          ars.push(ar[i]);
        }
      }
      return ars;
    },
    getFileType(ar) {
      //附件分类
      var ars = [];
      for (var i in ar) {
        ars.push(ar[i]);
      }
      ars.sort(function (a, b) {
        return a.typeOrder - b.typeOrder;
      });
      var rar = [];
      for (var i in ars) {
        if (rar.indexOf(ars[i].fjName) == -1) {
          rar.push(ars[i].fjName);
        }
      }
      return rar;
    },
    getFileIcon(file) {
      var kzname = file.fileAdd.split(".")[file.fileAdd.split(".").length - 1];
      //文件图标(需重做)
      var icon = "";
      switch (kzname) {
        case "doc":
          icon = "doc";
          break;
        case "docx":
          icon = "docx";
          break;
        case "xls":
        case "xlsx":
          icon = "xls";
          break;
        case "jpg":
        case "jpeg":
        case "bmp":
          icon = "jpg";
          break;
        case "png":
          icon = "png";
          break;
        case "pdf":
          icon = "pdf";
          break;
        case "ppt":
        case "pptx":
        case "pps":
          icon = "ppt";
          break;
        case "mp3":
          icon = "mp3";
          break;
        case "zip":
        case "rar":
        case "7z":
          icon = "mp3";
          break;
        default:
          icon = "xxx";
      }
      return icon;
    },
    openFile1(file, index) {},
    openFile2(file) {},
    editFile(file) {},
    downFile(filePath, fileName) {},
    viewFile(filePath) {
      this.vdisabled = true;
      //查看文档
      this.$refs.attachment.init(filePath);
    },
    setJSON(str) {
      //文本转JSON
      return JSON.parse(str);
    },
    watermark(str) {
      //水印输出
      this.$nextTick(() => {
        var taht = this;
        var can = document.createElement("canvas");
        this.$refs.mydiv.appendChild(can);
        can.width = 250; //画布的宽
        can.height = 200; //画布的高度
        can.style.display = "none";
        can.globalAlpha = 0.0;

        var cans = can.getContext("2d");
        cans.rotate((-30 * Math.PI) / 180); //画布里面文字的旋转角度
        cans.font = "14px Microsoft JhengHei"; //画布里面文字的字体
        cans.fillStyle = "rgba(17, 17, 17, 0.10)"; //画布里面文字的颜色
        cans.textAlign = "center"; //画布里面文字的水平位置
        cans.textBaseline = "Middle"; //画布里面文字的垂直位置
        cans.fillText(str, 75, 165); //画布里面文字的间距比例

        var cans1 = can.getContext("2d");
        cans1.rotate((0 * Math.PI) / 180); //画布里面文字的旋转角度
        cans1.font = "14px Microsoft JhengHei"; //画布里面文字的字体
        cans1.fillStyle = "rgba(17, 17, 17, 0.10)"; //画布里面文字的颜色
        cans1.textAlign = "center"; //画布里面文字的水平位置
        cans1.textBaseline = "Middle"; //画布里面文字的垂直位置
        cans1.fillText(
          this.$moment(new Date()).format("YYYY-MM-DD HH:mm:ss"),
          75,
          185
        ); //画布里面文字的间距比例

        this.$refs.mydiv.style.backgroundColor = "255,255,255,0.2";
        this.$refs.mydiv.style.backgroundImage =
          "url(" + can.toDataURL("image/png") + ")"; //把画布插入到body中
      });
    },
    //刷新页面
    refreshTableData(data) {
      this.$emit("refreshTableData", data);
    },
    print() {},
    gaizhang() {},
    gaizhangExecute() {},
    gaizhangUrl(url, guid) {},
    download() {},
    closeWindow() {
      this.isGZVisiable = false;
    },
  },
};
</script>

